package com.interauto.bean.autoenum;

import javax.naming.ldap.PagedResultsControl;
import java.util.HashMap;
import java.util.Map;

public class HttpEnum {
    public enum HttpMeth{
        GET(1,"get"),POST(2,"post");
        private Integer httpmethtype;
        private String httpmethname;

        public Integer getHttpmethtype() {
            return httpmethtype;
        }

        public void setHttpmethtype(Integer httpmethtype) {
            this.httpmethtype = httpmethtype;
        }

        public String getHttpmethname() {
            return httpmethname;
        }

        public void setHttpmethname(String httpmethname) {
            this.httpmethname = httpmethname;
        }

        HttpMeth(Integer httpmethtype, String httpmethname) {
            this.httpmethtype = httpmethtype;
            this.httpmethname = httpmethname;
        }

        public static HttpMeth getHttpMeth(int id){
            switch (id){
                case 1:
                    return GET;
                case 2:
                    return POST;
                default:
                    return null;
            }
        }

        public static Map<Integer,String> getHttpMethMap(){
            Map<Integer,String> maps=new HashMap<>();
            for(HttpMeth httpMeth:HttpMeth.values()){
                maps.put(httpMeth.getHttpmethtype(),httpMeth.getHttpmethname());
            }
            return maps;
        }
    }

    public enum HttpType{
        HTTP(1,"http"),HTTPS(2,"https");
        private Integer httptype;
        private String httptypename;

        public Integer getHttptype() {
            return httptype;
        }

        public void setHttptype(Integer httptype) {
            this.httptype = httptype;
        }

        public String getHttptypename() {
            return httptypename;
        }

        public void setHttptypename(String httptypename) {
            this.httptypename = httptypename;
        }

        HttpType(Integer httptype, String httptypename) {
            this.httptype = httptype;
            this.httptypename = httptypename;
        }

        public static Map<Integer,String> getHttpTypeMap(){
            Map<Integer,String> maps=new HashMap<>();
            for(HttpType httpType:HttpType.values()){
                maps.put(httpType.getHttptype(),httpType.getHttptypename());
            }
            return maps;
        }
        public static HttpType getHttpType(int id){
            switch (id){
                case 1:
                    return HTTP;
                case 2:
                    return HTTPS;
                default:
                    return null;
            }
        }
    }
}
